package com.bruce.codeFactory.designMode.singleton;

/**
 * @author luotuan
 * @Description  高效模式2
 * @create 2019-02-21 22:01
 **/
public class SingletonDemo2 {
    private SingletonDemo2(){

    }
    private enum Singleton{
        INSTANCE;
        private final SingletonDemo2 instance;
        Singleton(){
            instance = new SingletonDemo2();
        }
        public SingletonDemo2 getInstance(){
            return instance;
        }
    }
    public static SingletonDemo2 getInstance(){
        return Singleton.INSTANCE.getInstance();
    }
}
